package main

import "fmt"

// Author : CSR丶WARRIOR
// Time ： 2020/10/16  12:52
// TOOLS : GoLand
// FILENAME : extend.go
// STATEMENT: 继承

//定义父类
type Person1 struct {
	id   uint
	name string
	age  uint
}

//子类
type teacher struct {
	Person1
	salary float64
}

type student struct {
	Person1
	score int
}

func main() {
	var stu = student{
		Person1: Person1{
			id: 1, name: "Tom",
		}, //部分初始化父类
		score: 500,
	}
	var t = teacher{
		Person1: Person1{2, "suse", 32}, //全部初始化父类
		salary:  8000,
	}
	fmt.Println(stu) //{{1 Tom 0} 500}
	fmt.Println(t)   //{{2 suse 32} 8000}
}
